import cv2
import numpy as np

img = cv2.imread('img/dotj.jpg')
# 灰色化
img1 = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# 二值化 阈值为127，超过127的像素点变为255，否则变为0  两个返回值
ret, dst = cv2.threshold(img1, 127, 255, cv2.THRESH_BINARY_INV)



print(ret)
cv2.imshow('img1', img1)
cv2.imshow('dst', dst)
cv2.waitKey(0)

